<?php
/* @var $this TenderController */
/* @var $model Tender */

$this->breadcrumbs=array(
	Yii::t('tender','Tenders'),
);

$this->menu=array(
	array('label'=>Yii::t('tender','Create Tender'), 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('tender-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Manage Tenders</h1>

<div class="advS"><span><?php echo CHtml::link(Yii::t('tender','Advanced Search'),'#',array('class'=>'search-button')); ?></span> <?php echo Yii::t('tender','Search Tips')?></div>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'tender-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		'tid',
		array(
			'name'=>'search_project',
			'value'=>'$data->project->projectname',
			'header'=>Yii::t('tender','Pid'),
		),
		'tendername',
		'rid',
		array(
			'name'=>'search_tenderer',
			'value'=>'$data->tenderer->name',
			'header'=>Yii::t('tender','Tenderer'),
		),
		array(
			'name'=>'mode',
			'value'=>'Tender::itemAlias("ModeStatus",$data->mode)',
			'filter'=>Tender::itemAlias("ModeStatus"),
		),
		/*
		'saletime',
		'opentime',
		'userid',
		'department',
		'status',
		*/
		array(
			'class'=>'CButtonColumn',
			'template'=>'{view}{update}{namelists}{delete}',
			'buttons'=>array(
				'namelists'=>array(
					'label'=>Yii::t('tender','Namelist'),
					'imageUrl'=>'',
					'url'=>'Yii::app()->createUrl("Tender/Namelist", array("tid"=>$data->tid))',
				),
			),
		),
	),
)); ?>
